You are assuming the Judge is working in your favor. The judge can do whatever he wants in the courtroom. He's in charge. If it is illegal in some way you can appeal, but then again it is up to you to prove to the Judges collegues that he was wrong. Not easy. The Judicial system is very screwed up and in most cases wrong. Gather all info, plead not guilty if there is even a small chance you were, and hope the cop doesn't show.